package com.tj.bo.product.server.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.tj.bo.product.server.dao.ProductDao;
import com.tj.bo.product.server.entity.ProductEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: xulin
* Date: 2020-07-22
* Time: 18:41:59.577
*/

@Repository
public class ProductDaoImpl extends AbstractBaseMapper<ProductEntity> implements ProductDao {



    @Override
    public List<ProductEntity> getAllProduct() {
        return getSqlSession().selectList("getAllProduct");
    }

    @Override
    public ProductEntity getByProductCode(String productCode) {
        Map param = new HashMap<>();
        param.put("productCode", productCode);
        return getSqlSession().selectOne("getByProductCode", param);
    }

    @Override
    public int updateProductByOdds(String variableOdds, String productCode) {
        Map param = new HashMap<>();
        param.put("variableOdds", variableOdds);
        param.put("productCode", productCode);
        return getSqlSession().update("updateProductByOdds", param);
    }

    @Override
    public int updateProductByInitOdds(String productCode) {
        Map param = new HashMap<>();
        param.put("productCode", productCode);
        return getSqlSession().update("updateProductByInitOdds", param);
    }

    @Override
    public int updateProductByMiniOdds(String productCode) {
        Map param = new HashMap<>();
        param.put("productCode", productCode);
        return getSqlSession().update("updateProductByMiniOdds", param);
    }
}